<!--资源录入-单站-->
<template>
  <t-collapse title="项目验收信息">
    <TForm ref="enteringForm" :form="formData" :rules="rules" :form-options="formOptions" :first-accept-time="firstAcceptTime" :yanfa="getYanFa" />
    <accButton :prj-id="prjId" :btn-list="btnOptions" />
  </t-collapse>
</template>
<script>
import TForm from '../form/index.vue'
import accButton from '../accButton.vue'
import { Mixins } from '@/views/acceptance/components/minix'
import { getAcceptProcessInitiationTime } from '@/api/acceptanceManagement/acceptanceMange'
export default {
  components: {
    TForm,
    accButton
  },
  mixins: [Mixins],
  data() {
    return {
      btnList_: ['serviceEdit', 'entering', 'materialApplyRetreat', 'addValuation', 'costSheet', 'panorama'],
      formList: ['realStartTime', 'realEndTime', 'endInternalAcceptDate', 'endInstallDate', 'jiaofuApplicationDate', 'resourceInTime', 'resourceConfirmTime'],
      firstAcceptTime: ''
    }
  },
  computed: {
    // 研发项目
    getYanFa() {
      return this.newPrjDetail.manageMode === '01' && this.newPrjDetail.prjType === 'Y'
    },
    // 单站=>智联项目
    getShowOne() {
      return (this.newPrjDetail.manageMode === '01' && this.newPrjDetail.isNewBusiness === '1')||(this.newPrjDetail.isNewBusiness === '0'&&this.newPrjDetail.businessMajor==='04')
    },
    // 服务成本=>设备录入
    getShowTwo() {
      return this.newPrjDetail.prjType === 'W' && this.newPrjDetail.buildModes === '26'
    },
    btnList() {
      if (this.getYanFa) {
        return ['serviceEdit', 'entering', 'panorama']
      }
      // 代建类项目 服务成本不显示 乙供物资明细配置
      if (this.getShowOne) {
        return this.getShowTwo ? this.commonButtonShow(['serviceEdit', 'entering', 'panorama'] ): this.commonButtonShow(this.btnList_)
      } else {
        // 通信项目
        return this.btnList_
      }
    }
  },
  created() {
    this.formList = this.getYanFa ? ['endInternalAcceptDate'] : this.formList
    // 研发
    if (this.getYanFa) {
      this.getEndTime()
    }
  },
  methods: {
    async getEndTime() {
      const { code, data } = await getAcceptProcessInitiationTime({ prjId: this.prjId })
      if (+code === 200) {
        this.firstAcceptTime = data
      }
    }
  }
}
</script>
<style scoped lang='scss'></style>
